home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-04 / prolog_2.zip / CHART.ZIP / TEST02.PRO < prev   
Text File  |  1987-03-31  |  1KB  |  47 lines

  1. /*
  2.   File:         test02.pro
  3.   Author:       Peter Ross
  4.   Updated:      3 June 1985
  5.  
  6.  ============ SAMPLE GRAMMAR ============
  7. */
  8.  
  9. initial_category(trial,s).
  10. strategy(trial,S) :-
  11.         prompt(_,'Strategy (td/bu): '),
  12.         read(S),
  13.         member(S,[td,bu]),
  14.         !.
  15. strategy(trial,S) :-
  16.         write('Answer  td.  or  bu.  please'), nl,
  17.         strategy(trial,S).
  18. policy(trial,P) :-
  19.         prompt(_,'Policy (bf/df):   '),
  20.         read(P),
  21.         member(P,[bf,df]),
  22.         !.
  23. policy(trial,P) :-
  24.         write('Answer  df.  or  bf.  please'), nl,
  25.         policy(trial,P).
  26.  
  27. rule(trial, s(P),  [np(P), vp(P)]).
  28. rule(trial, np(P), [det, n(P)]).
  29. rule(trial, np(P), [np(P), pp]).
  30. rule(trial, vp(P), [v(P)]).
  31. rule(trial, vp(P), [v(P), np(_)]).
  32. rule(trial, vp(P), [v(P), np(_), pp]).
  33. rule(trial, pp, [p, np(_)]).
  34.  
  35. lexical(trial, the,       [det]).
  36. lexical(trial, a,         [det]).
  37. lexical(trial, man,       [n(singular),v(singular)]).
  38. lexical(trial, women,     [n(plural)]).
  39. lexical(trial, park,      [n(singular)]).
  40. lexical(trial, telescope, [n(singular)]).
  41. lexical(trial, in,        [p]).
  42. lexical(trial, with,      [p]).
  43. lexical(trial, saw,       [n(singular),v(singular)]).
  44. lexical(trial, likes,     [v(singular)]).
  45.  
  46.  
  47.